package com.bm.server.task;

import com.bm.server.config.RedisKeyConfig;
import com.bm.server.dao.CharmDtoDao;
import com.bm.server.dto.CharmDto;
import com.bm.server.util.JedisUtil;
import com.bm.server.util.RedissonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
 * |                     ______                     |
 * |                  .-"      "-.                  |
 * |                 /            \                 |
 * |     _          |              |          _     |
 * |    ( \         |,  .-.  .-.  ,|         / )    |
 * |     > "=._     | )(__/  \__)( |     _.=" <     |
 * |    (_/"=._"=._ |/     /\     \| _.="_.="\_)    |
 * |           "=._"(_     ^^     _)"_.="           |
 * |               "=\__|IIIIII|__/="               |
 * |              _.="| \IIIIII/ |"=._              |
 * |    _     _.="_.="\          /"=._"=._     _    |
 * |   ( \_.="_.="     `--------`     "=._"=._/ )   |
 * |    > _.="                            "=._ <    |
 * |   (_/                                    \_)   |
 * |                                                |
 * '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='
 * -----------------代码的搬运工-----------------
 *
 * @Date: 2022/07/26/19:38
 */
@Component
public class CharmTask {
    @Resource
    private CharmDtoDao dao;
    private Logger logger = LoggerFactory.getLogger(CharmTask.class);
    @Scheduled(cron = "0 0 6 * * ?")
    public void charmNewTop(){
        logger.info("开始执行定时任务");
        List<CharmDto> list = dao.selectbycharm();
        System.out.println(list);
        RedissonUtil.addList(RedisKeyConfig.CHARM_TOP_MEI,list);
        logger.info("结束执行定时任务");

    }
}
